<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /*
    使用'0b'将字符串s标记成二进制数，然后再用BigInt转换，可以得到十进制BigInt数
    */
    function array(arr) {
      let num = Number('0b' + arr)
      let semp = 0
      while (num !== 1) {
        if (num % 2 === 0) {
          num /= 2
        }
        else {
          num += 1
        }
        semp++
      }
      return semp
    }
    console.log(array("1101"))
  </script>
</body>

</html>